{% extends "data_edit.html" %}
{% load i18n %}

{% block form %}
{% autoescape off %} 
<tr><td>

  <table width="100%" border="0" cellspacing="0" cellpadding="3">
     
                     <tr>
                        <th height="20">{{ form.DeptID|field_as_label_tag }}</th>
                        <td>{{form.DeptID.as_widget }}</td>
                        <td>{{form.DeptID.errors }}</td>
                        
                     </tr>
             <!--
             ##增加时间：2014-03-05
             ##增加人：David.Dai@zkteco.com
             ##增加原因：新员工自助：让上级职位的显示具有树的效果
             -->
             {%if "USE_NEW_SELFSERVICE"|filter_config_option%}
    		 <tr>
                <th height="20">
                	<label for="id_parent">{% trans '上级职位' %}:</label>
                </th>
                <td>
                <input id="id_show_input" class="wZBaseCharField input_showDeptTree" type="text" readonly="readonly"></input>
				<span class="t_btn_showDeptTree">
				    <img id="id_drop_dept" onclick="javascript:$(this).parent().find('#show_deptment').show().bgiframe();" src="/media/img/sug_down_on.gif"></img>
				    <div id="show_deptment" style="display: none;">
				        <div class="title" >
				            <span class="span_selectNone Link_blue1" onclick="javascript:set_position_null()"> 
		                        <a href="javascript: void(0)">{% trans '撤销选择' %}</a>&nbsp;&nbsp; 
		                    </span>
				            <span class="close btn" onclick="javascript:$(this).parent().parent().parent().find('#show_deptment').hide();">
				                {% trans '确定' %}
				            </span>
				        </div>
				        <div id="id_dept" class="dispayN">
				            <ul id="position_tree_by_dept" class="tree"></ul>
				        </div>
				    </div>
				
				</span>
				<div>
				
				</div></td>
                <td><td/>
                
             </tr>
             {%endif%}
             <!-- 上级职位结束 -->
    	<tr>
        	{{form.name|field_as_td_h}}
      		<td  >{{form.name.errors }}</td>
      
   		</tr>
    	<tr>
        	{{form.code|field_as_td_h}}
	 
      		<td>
				{{form.code.errors }}
				<div id="yanzheng" class="floatL Link_blue1 lineH22">
				<a href="javascript:void(0)" onclick="wgCheckNo('code','div_id_code',this,'{{dbapp_url}}','personnel','Position')">{%trans '验证'%}</a>
				</div>
				<div id='div_id_code'  class="floatL color_orange lineH22"></div>
			</td>
     
    	</tr>
    	<!--
             ##增加时间：2014-03-05
             ##增加人：David.Dai@zkteco.com
             ##增加原因：新员工自助：职位显示是否具有审批功能
        -->
    	{%if "USE_NEW_SELFSERVICE"|filter_config_option %}
    	<tr>
        	{{form.isAudit|field_as_td_h}}
      		<td  >{{form.isAudit.errors }}</td>
      
   		</tr>
   		{%endif%}
		<!-- 审批功能结束 -->
   {% for i,k in form.errors.items %}
   {{i}}{{k}}
   {% endfor %}
   

  </table>
</td></tr>

{% endautoescape %}
{% endblock %}
{% block addjs %}
	$("label[for='id_code']").attr("class","required");
	$(function(){
		if($("#id_edit_form").find("#id_code").val()!=""){
			$("#yanzheng").hide()
		}else{
			$("#yanzheng").show()
		}
	});
	//##增加时间：2014-03-05
    //##增加人：David.Dai@zkteco.com
    //##增加原因：新员工自助：让职位刚进入编辑界面的时候，上级职位就根据部门渲染成树
	{%if "USE_NEW_SELFSERVICE"|filter_config_option %}
	if ('{{add}}' == 'False'){
		var url = "/personnel/select_new_position/personnel/Position/?DeptID=";
        var items = document.getElementsByName("DeptID");
        if(items.length !=0){
            var array = items[0].value;
        }
        if (array!=""||array != undefined){
        url+=array;
        url = url+"&model_pk="+$("#id_model_pk").val()+"&model_info="+$("#id_model_info").attr("model_name")
        ajax_ztree(url);
      }
	}
	{%endif%}
	//=======================================
    <!--{% if "USE_ABROAD_ATT"|filter_config_option %}-->
        <!--$("#id_isAudit").parent().parent().hide();-->
    <!--{% endif %}-->
{% endblock %}